function getLocationInfo(longitude, latitude) {
	return new Promise((resolve, reject) => {
		var apiUrl =
			'https://restapi.amap.com/v3/geocode/regeo?key=49555c23c089363d0ea2751bba7c669b&location=' +
			longitude + ',' + latitude;

		uni.request({
			url: apiUrl,
			method: 'GET',
			success: (res) => {
				const data = res.data;
				if (data.status === '1' && data.regeocode && data.regeocode.addressComponent && data
					.regeocode
					.addressComponent.city) {
					let city = null
					if (data.regeocode.addressComponent.city.length > 0) {
						city = data.regeocode.addressComponent.city
					} else if (data.regeocode.addressComponent.province.includes("市")) {
						city = data.regeocode.addressComponent.province
					}
					uni.setStorage({
						key: "firstCtiy",
						data: data.regeocode.addressComponent.adcode,
					})
					uni.setStorage({
						key: "firstCtiyName",
						data: data.regeocode.addressComponent.city
					})
					// 解析返回的 JSON 数据并解析
					resolve(data);
				} else {
					console.log('未知');
					reject('未知');
				}
			},
			fail: (error) => {
				console.error('发生错误：', error);
				reject(error);
			}
		});
	});
}

module.exports = {
	getLocationInfo
}